package com.todo.biz.application.entity;


import com.todo.common.common.enums.BusinessSceneEnum;
import com.todo.biz.common.enums.CounterTypeEnum;

/**
 * @author azhebuxing
 * @date 2024/5/8 14:31
 * @description
 */
public class BizBaseRedisKeyUtil {

    /**
     * 计数数量key
     */
    static String BIZ_BASE_COUNTER_COUNT_KEY = "biz:base:counter:count:%s:%s:%s";
    /**
     * 计数业务id存在key
     */
    static String BIZ_BASE_COUNTER_ID_KEY = "biz:base:counter:id:%s:%s:%s";

    public static String getBizCounterCountKey(BusinessSceneEnum scene, CounterTypeEnum counterType, Long bizId) {
        return String.format(BIZ_BASE_COUNTER_COUNT_KEY, scene.getSceneCode(), counterType.getCode(), bizId);
    }

    public static String getBizCounterIdKey(BusinessSceneEnum scene, CounterTypeEnum counterType, Long bucket) {
        return String.format(BIZ_BASE_COUNTER_ID_KEY, scene.getSceneCode(), counterType.getCode(),bucket);
    }
}
